import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import '../style/less/main.css';
import axios from '../api/index';
import {Button ,mountNode } from 'antd';
import { createStore } from 'redux';
import { Provider, connect } from 'react-redux';
import actions from '../actions/index';
 import {reducer} from '../reducers/index';

class App extends Component{
    render() {
        const {text, add2,del2} = this.props;
        debugger;
        return (
            <div>
                <h1> {text} </h1>
                <button onClick={add2}>+1</button>
                <button onClick={del2}>-1</button>
            </div>
        );
    }
}



class AddToDo extends React.Component{
    constructor(){
        super();
        
        
    }
    
    render(){
        return(
          <div style={{marginLeft:180}}>
       
          <Provider store={store}>
                <App />
            </Provider>,
          
        </div>
           )
    }
}

// let store = createStore(reducer);

// //映射Redux state到组件的属性
// function mapStateToProps(state) {
//     return { text: state.text }
// }
// function mapDispatchToProps(dispatch){
//     return{
//         add2:()=>dispatch(actions.add),
//         del2:()=>dispatch(actions.del)
//     }
//     }
// //连接组件
// App = connect(mapStateToProps, mapDispatchToProps)(App)
 export default AddToDo;